# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gnome-bluetooth
pkgver=42.0
pkgrel=0
pkgdesc="The GNOME Bluetooth Subsystem"
url="https://wiki.gnome.org/Projects/GnomeBluetooth"
# riscv64, s390x: blocked by gtk4.0-dev, libadwaita-dev, upower-dev
arch="all !riscv64 !s390x"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
depends="bluez>=5 bluez-obexd"
makedepends="
	eudev-dev
	glib-dev
	gobject-introspection-dev
	gsound-dev
	gtk4.0-dev
	libadwaita-dev
	libnotify-dev
	meson
	upower-dev
	"
checkdepends="py3-dbus py3-gobject3 py3-dbusmock"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-libs"
source="https://download.gnome.org/sources/gnome-bluetooth/${pkgver%.*}/gnome-bluetooth-$pkgver.tar.xz
	61-gnome-bluetooth-rfkill.rules"

if [ "$CARCH" = "armhf" ]; then
	options="!check"; # tests fail on armhf
fi

build() {
	abuild-meson output .
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	install -m644 -D "$srcdir/61-gnome-bluetooth-rfkill.rules" \
		"$pkgdir/lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules"
}

sha512sums="
769bd9300fa1d830240e84257230425fe7f2e871cbd6c8fa6416514487a26326601a21c16075a66cf886850bab17f5c8e2235463f3695ea194c9230d6e50337c  gnome-bluetooth-42.0.tar.xz
68ea6502a469d800e92d8984984cfddfa66e7bf8a0252d52a2338843d183680c84aa7ec6c4c7d14a250515b34b71d89364480c809743ba9e7ef30473b8ebb5a8  61-gnome-bluetooth-rfkill.rules
"
